﻿using duia.Canteenpay.Domain.DomainObject;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System.Collections.Generic;

namespace duia.Canteenpay.Repository.EntityConfiguration
{
    /// <summary>
    /// 系统用户-ef映射管理
    /// </summary>
    public class UsersEntityTypeConfiguration : BaseEntityTypeConfiguration<Users>
    {
        public override void Configure(EntityTypeBuilder<Users> builder)
        {
            builder.ToTable("canpay_users");
            builder.HasKey(x => x.KeyId);
            builder.Property(x => x.Account).IsRequired().HasMaxLength(50);
            builder.Property(x => x.UserName).IsRequired().HasMaxLength(50);
            builder.Property(x => x.UserPassWord).IsRequired().HasMaxLength(100);
            builder.HasData(new List<Users>()
            {
                new Users("admin","123456","admin")
            });
            base.Configure(builder);
        }
    }
}
